package com.wallet.util;

import java.util.ArrayList;
import java.util.List;

import com.wallet.entity.form.RoutesForm;

public class RouteTreeUtil {
	
	public static List<RoutesForm> buildTree(List<RoutesForm> listRoutesForm,int pid){
		List<RoutesForm> treeList=new ArrayList<RoutesForm>();
		for (RoutesForm routesForm : listRoutesForm) {
			if(routesForm.getPid()==pid) {
				routesForm.setChildren(buildTree(listRoutesForm, routesForm.getId()));
				treeList.add(routesForm);
			}
		}
		return treeList;
	}

}
